package com.gyt.manager.controller.risk;

import com.gyt.manager.common.base.BaseController;
import com.gyt.manager.common.base.exception.BaseException;
import com.gyt.manager.common.base.response.Response;
import com.gyt.manager.domain.risk.FunctionLibraryInfo;
import com.gyt.manager.service.FunService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author gyt
 */
@RestController
@RequestMapping("resource")
@Api(tags = "resource-function", description = "资源中心-函数", value = "function")
public class FunctionController extends BaseController {

    @Autowired
    FunService funService;

    @GetMapping("function/findFunctionTypeInfoById.do")
    @ApiOperation(value = "根据id查询函数类型信息", notes = "函数")
    public Response<FunctionLibraryInfo> findFunctionTypeInfoById(
            @ApiParam(value = "函数类型id",required = true) @RequestParam(value = "fid") Integer fid) {
        try {
            FunctionLibraryInfo result = funService.findFunctionTypeInfoById(fid);
            return Response.ok(result, null);
        } catch (BaseException e) {
            return Response.error(e, null);
        } catch (Exception e) {
            return Response.error(e, null);
        }
    }


}
